﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Buddy.BehaviorTree;
using Buddy.CommonBot;
using Buddy.Swtor;
using Buddy.Swtor.Objects;


namespace WingIt.Routines.Mirrors
{
    /// <summary>
    /// <para>Base class for all Routines.</para>
    /// <para>This class should only contain static methods that are common to all classes.</para>
    /// </summary>
    ///  9Jul2012-00:26UTC chinajade
    [RevisionControlId("$Id: MirrorRoutine.cs 684 2012-08-08 10:09:07Z Chinajade $")]
    public class MirrorRoutine
    {   
        #region Predicates
        protected static bool IsElite { get { return BuddyTor.Me.CurrentTarget != null && BuddyTor.Me.CurrentTarget.Toughness >= CombatToughness.Strong; } }
        #endregion

        #region Access Convenience
        protected static TorPlayer Me { get { return (BuddyTor.Me); } }
        protected static TorCharacter MyTarget { get { return (TargetSelect.ForAttack()); } }
        protected static TorCharacter Tank { get { return (TargetSelect.Tank); } }
        protected static TorCharacter Healer { get { return (TargetSelect.Healer); } }
        protected static TorCharacter HealTarget { get { return (TargetSelect.ForHeal()); } }
        protected static TorCharacter CCTarget { get { return (TargetSelect.ForCrowdControl()); } }
        protected static TorCharacter DispellTarget { get { return (TargetSelect.ForDispell()); } }
        protected static TorCharacter InterruptTarget { get { return (TargetSelect.ForInterrupt()); } }
        protected static TorCharacter DebuffTarget { get { return (TargetSelect.ForDebuff()); } }
        protected static TorCharacter ShieldTarget { get { return (TargetSelect.ForShield()); } }
        protected static TorCharacter TauntTarget { get { return (TargetSelect.ForTaunt()); } }
        protected static float Resource { get { return Me.ResourcePercent(); } }
        protected static Composite Cast(string abilityName, BooleanValueDelegate requirements = null) { return Mirror.Cast(abilityName, requirements); }
        protected static Composite Cast(string abilityName, CharacterSelectionDelegate onCharacter, BooleanValueDelegate requirements = null) { return Mirror.Cast(abilityName, onCharacter, requirements); }
        protected static Composite BuffSelf(string buffName, BooleanValueDelegate requirements = null) { return Mirror.BuffSelf(buffName, requirements); }
        protected static Composite CastOnGround(string abilityName, CommonBehaviors.Retrieval<Buddy.Common.Math.Vector3> location, BooleanValueDelegate requirements) { return Mirror.CastOnGround(abilityName, location, requirements); }
        #endregion
        
        #region Decision-making Convenience
        protected static bool CCBreak { get { return (BuddyTor.Me.IsStunned); } }
        // Consumable buffs are not 'mirrors', so don't try to make them such...
        // They are the result of consumables, relics, and other such devices.
        protected static bool  MeHasConsumableBuff(string buffName) { return (Me.HasBuff(buffName)); }
        protected static bool  RequiresCrowdControl { get { return BuddyTor.Me.CurrentTarget != null && (BuddyTor.Me.CurrentTarget.IsCasting || !(BuddyTor.Me.CurrentTarget.Toughness == CombatToughness.Standard || BuddyTor.Me.CurrentTarget.Toughness == CombatToughness.Weak)); } }
        #endregion
    }
}
